package com.jiawa.train.business.controller.admin;

import com.jiawa.train.common.resp.PageResult;
import com.jiawa.train.common.resp.Result;
import com.jiawa.train.business.req.DailyTrainSeatQueryReq;
import com.jiawa.train.business.req.DailyTrainSeatSaveReq;
import com.jiawa.train.business.service.DailyTrainSeatService;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/admin/dailyTrainSeat")
@Slf4j
public class DailyTrainSeatAdminController {

    @Resource
    private DailyTrainSeatService dailyTrainSeatService;
    @PostMapping("/save")
    public Result save(@RequestBody @Valid DailyTrainSeatSaveReq req) {
        dailyTrainSeatService.save(req);
        return Result.success();
    }
    @GetMapping("/page")
    public Result<PageResult> queryDailyTrainSeatList(DailyTrainSeatQueryReq  req) {
       PageResult pageResult = dailyTrainSeatService.queryDailyTrainSeatList(req);
       return Result.success(pageResult);
    }
    @DeleteMapping("/delete/{id}")
    public Result delete(@PathVariable Long id) {
        dailyTrainSeatService.delete(id);
        return Result.success();
    }
}

